import datetime

from question.models import TbFenbiResponse, RxPaperUrl


def get_fenbi():
    papers = TbFenbiResponse.objects.all().values()
    for paper in papers:
        now = datetime.datetime.now()
        exercise = paper["exercise"].replace("null", "None")
        info = {
            "paper_name": paper["name"],
            "url": "https://www.fenbi.com/spa/tiku/report/exam/solution/xingce/xingce/" + str(
                eval(exercise)["id"]) + "/3",
            "type": "国考模拟题",
            "create_time": str(now),
            "update_time": str(now)
        }
        RxPaperUrl.objects.create(**info)


def test():
    get_fenbi()
